import { createRouter, createWebHistory } from "vue-router"
import { routes } from "./commonRoutes"
import { $Storage } from "@utils/storage.js"


const router = createRouter({
  history: createWebHistory(),
  routes,
})



router.beforeEach((to, from, next) => {
  console.log(to)
  console.log(from)
  next()
  // if (!$Storage.getItem("jwttoken")) {
  //   next("/login")
  // } else {
  //   next()
  // }
})

export const setUpRouter = (app) => {
  app.use(router)
}

export default router